package com.tedu.spring.boot.demo1.exception;

import com.tedu.spring.boot.demo1.common.JSONResult;
import com.tedu.spring.boot.demo1.common.ResponseStatus;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * Author：毕龙
 * Date: 2024/8/27 16:43
 */
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {


    @ExceptionHandler
    public JSONResult runtimeException(RuntimeException e){
        log.debug("{}",e.getMessage());

        return JSONResult.fail(ResponseStatus.ERROR_SERVICE,e.getMessage());
    }

}
